package com.imis.module.api.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.imis.base.globle.Result;
import com.imis.module.api.bus.ActuatorRedisBus;
import com.imis.module.api.model.vo.RedisInfoVO;
import com.imis.module.base.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * DuplicateCheckController<br>
 * 数据重复校验 前端控制器
 * </p>
 *
 * @author XinLau
 * @version 1.0
 * @since 2020年06月30日 09:02
 */
@Slf4j
@RestController
@RequestMapping("/actuator/redis")
@Api(tags = {"Redis性能监控"})
@ApiSort(5)
public class ActuatorRedisController extends BaseController<ActuatorRedisBus> {

    @RequestMapping(value = "/info", method = RequestMethod.GET)
    @ApiOperation(value = "获取Redis服务信息", notes = "获取Redis服务信息")
    @ApiOperationSupport(order = 1, author = "XinLau")
    public Result<List<RedisInfoVO>> getRedisServeRedisInfo(){
        return service.getRedisServeInfo();
    }

    @RequestMapping(value = "/keysSize", method = RequestMethod.GET)
    @ApiOperation(value = "获取RedisKey实时数量信息", notes = "获取RedisKey实时数量信息")
    @ApiOperationSupport(order = 2, author = "XinLau")
    public Result getRedisServeKeysSize(){
        return service.getRedisServeKeysSize();
    }

    @RequestMapping(value = "/memoryInfo", method = RequestMethod.GET)
    @ApiOperation(value = "获取Redis内存实时占用情况信息", notes = "获取Redis内存实时占用情况信息")
    @ApiOperationSupport(order = 3, author = "XinLau")
    public Result getRedisServeMemoryInfo(){
        return service.getRedisServeMemoryInfo();
    }

    @RequestMapping(value = "/serverMemoryInfo", method = RequestMethod.GET)
    @ApiOperation(value = "获取服务器磁盘占用情况信息", notes = "获取服务器磁盘占用情况信息")
    @ApiOperationSupport(order = 4, author = "XinLau")
    public Result getServerMemoryInfo(){
        return service.getServerMemoryInfo();
    }

}
